import {
	http,
	Method
} from "@/utils/request.js";

import api from "@/config/api.js";


/**
 * 获取基本信息
 * @param 
 */
export function statInfo() {
	return http.request({
		url: '/users/stats',
		method: Method.GET
	});
}


/**
 * 获取收入信息
 * @param 
 */
export function incomeInfo() {
	return http.request({
		url: '/users/withdrawable-commission-stats',
		method: Method.GET
	});
}

/**
 * 提交工单
 * @param 
 */
export function appeal(parmas) {
	return http.request({
		url: '/orders/complaint/submit',
		method: Method.POST,
		data: parmas
	});
}

/**
 * 获取工单列表
 * @param 
 */
export function appealList(data) {
	return http.request({
		url: '/orders/complaint/list',
		method: Method.GET,
		data
	});
}

/**
 * 获取佣金明细
 * @param 
 */
export function balanceBill(parmas) {
	return http.request({
		url: `/users/balance/records`,
		method: Method.GET,
		data: parmas
	});
}

/**
 * 获取提现明细
 * @param 
 */
export function withdrawList(parmas) {
	return http.request({
		url: `/users/withdraw/records`,
		method: "GET",
		data: parmas
	});
}

/**
 * 获取发布的圈子
 * @param 
 */
export function postsMyList(parmas) {
	return http.request({
		url: `/posts/my`,
		method: "GET",
		data: parmas
	});
}

/**
 * 获取我的闲置
 * @param 
 */
export function idleList(parmas) {
	return http.request({
		url: `/posts/idle/list?type=${parmas.type}`,
		method: "GET",

	});
}
/**
 * 业主认证
 * @param 
 */
export function editCertificationInfo(parmas) {
	return http.request({
		url: `/users/auth`,
		method: "POST",
		data: parmas
	});
}

/**
 * 修改业主认证
 * @param 
 */
export function updataCertificationInfo(parmas) {
	return http.request({
		url: `/users/auth/update`,
		method: "PUT",
		data: parmas
	});
}



/**
 * 获取业主认证信息
 * @param 
 */
export function getCertificationInfo() {
	return http.request({
		url: '/users/auth/detail',
		method: "GET",
	});
}


/**
 * 获取评分
 * @param 
 */
export function orderComment(params) {
	return http.request({
		url: `/users/${params.id}/credit-score/history`,
		method: "GET",
		data: params.data
	});
}

/**
 * 获取收货地址信息
 * @param 
 */
export function userAddress() {
	return http.request({
		url: '/users/addresses',
		method: Method.GET
	});
}


/**
 * 新增收货地址信息
 * @param 
 */
export function addUserAddress(data) {
	return http.request({
		url: '/users/addresses',
		method: Method.POST,
		data
	});
}

/**
 * 编辑收货地址信息
 * @param 
 */
export function updateUserAddress(paramse) {
	return http.request({
		url: `/users/addresses/${paramse.id}`,
		method: Method.PUT,
		data: paramse.data
	});
}


/**
 * 删除收货地址信息
 * @param 
 */
export function deleteAddressInfo(id) {
	return http.request({
		url: `/users/addresses/${id}`,
		method: Method.DELETE,
	});
}